<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <button @click="changeDancer">change</button>
        <ul>
            <li v-for="item, index of dancer" key="item">item:{{item}}, index:{{index}}</li>
        </ul>
    </div>
    <script>
        Vue.config.productionTip = false;
        
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    dancer:["佟丽娅", "杨丽萍", "杨洋", "刘诗诗"]
                }
            },
            methods: {
                changeDancer() {
                    // this.dancer[0] = '杨幂'; //通过下标改，不具备响应式
                    //this.dancer.length = 1;//通过数组长度length改，不具备响应式
                    //this.dancer.push('肖战');//数组变更方法都可以，pop/shift/push/unshift/splice/sort/reverse
                    this.dancer = this.dancer.filter(item => {
                        return item.startsWith('杨');//字符串已***开头
                    })
                }
            },
        })
</script>
</body>

</html>